﻿using System;
using System.Drawing;

namespace System
{
	public partial struct V3D
	{
		public static implicit operator PointF(V3D V)
		{
			return new PointF((float)V.X, (float)V.Y);
		}
		public static implicit operator V3D(PointF P)
		{
			return new V3D(P.X, P.Y, 0);
		}
		public static implicit operator V3D(Point P)
		{
			return new V3D(P.X, P.Y, 0);
		}
		public static implicit operator Color(V3D V)
		{
			return Color.FromArgb((int)(V.X * 255), (int)(V.Y * 255), (int)(V.Z * 255));
		}
		public static implicit operator V3D(Color C)
		{
			return new V3D(C.R / 255.0, C.G / 255.0, C.B / 255.0);
		}

		public void DrawGraphics(Graphics G, Brush B, double Size)
		{
			if (Size > 0)
				G.FillRectangle(B, (float)(X - Size), (float)(Y - Size), (float)Size * 2, (float)Size * 2);
		}
		public Pen ToPen(double Width)
		{
			return new Pen(Color.FromArgb((int)X, (int)Y, (int)Z), (float)Width);
		}
	}
}